package com.example.ioc.v2;

public class Main {
    public static void main(String[] args) {
        Tire tire = new Tire();
        Bottom bottom = new Bottom(tire);
        Framework framework = new Framework(bottom);
        Car car = new Car(framework);
        car.run();
    }
}

class Car {

    public Car(Framework framework) {
        System.out.println("car init");
    }

    public void run() {
        System.out.println("car run run!");
    }
}

//车身
class Framework {
    public Framework(Bottom bottom) {
        System.out.println("Framework init");
    }
}

//底盘
class Bottom {
    public Bottom(Tire tire) {
        System.out.println("bottom init");
    }
}

//轮子
class Tire {
    //轮子尺寸
    private int size;

    public Tire() {
        this.size = 15;
        System.out.println("tire init");
    }
}

